#ifndef __VINES__H__
#define __VINES__H__

#include "cocos-ext.h"
#include "cocos2d.h"
#include "Config.h"
#include "Monkey.h"

USING_NS_CC;
USING_NS_CC_EXT;
using namespace cocos2d::gui;


class Vines : public CCSprite
{
public:

	/// 
	/// Khoi tao
	/// 
	/// type: loai day leo dua vao
	/// p: diem xuat hien day leo 
	/// left: ben trai hoac phai so voi cay
	///
	/// Khoi tao day leo moi
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	Vines(Monkey* monkey);
	Vines(int type, Monkey* monkey);
	Vines(int type, CCPoint p, Monkey* monkey);
	Vines(int type, CCPoint p, int left, Monkey* monkey);

	/// 
	/// Khoi tao
	/// 
	/// type: loai day leo dua vao
	/// p: diem xuat hien day leo 
	/// left: ben trai hoac phai so voi cay
	///
	/// Khoi tao day leo moi, ban dau qua mac dinh se xuat hien san
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	void initValueForAttribute(int type, CCPoint p, int left, Monkey* monkey);

	/// 
	/// Select image
	/// 
	/// Chon anh tuong ung voi loai day leo
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	char* fSelectObjectImage();

	/// 
	/// update
	/// 
	/// update trang thai moi cua day leo
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	virtual void update(float dt);

	/// 
	/// load music
	/// 
	/// phan am thanh
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	void fPreLoadMusic();

	/// 
	/// setter, geteter type
	///
	/// type: loai day leo can thay doi
	/// 
	/// SetType: Thay doi loai day leo
	/// GetType: tra ve loai day leo hien tai
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	inline void fSetType(int type){mType = type;};
	inline int fGetType(){return mType;};

	///
	/// Setter, Geteter trang thai hien tai cua day leo
	/// 
	/// status: trang thai can thay doi
	///
	/// SetStatus: thay doi trang thai hien tai cua day leo
	/// GetStatus: tra ve trang thai hien tai cua day leo
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	inline void fSetStatus(int status) {mNewStatus = status;}
	inline int fGetStatus() {return mCurrentStatus;}

	///
	/// Setter, Geteter trai phai so voi cay
	/// 
	/// left: ben trai hoac phai
	///
	/// SetIsLeft: Gan trai phai so voi cay cho day leo
	/// GetIsLeft: Tra ve vi tri trai phai so voi cay
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	inline void fSetIsLeft(int left) {mIsLeft = left;}
	inline int fGetIsLeft() {return mIsLeft;}
	
	/// 
	/// effect
	/// 
	/// Cac hanh dong tuong ung voi tung trang thai cua day leo
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	void fEffect();

	/// 
	/// collision with monkey
	/// 
	/// sp1: bounding cua day leo
	/// sp2: bounding cua khi (o day chi lay than)
	///
	/// kiem tra va cham giua khi va day leo
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	bool fCollisionWithMonkey(CCRect sp1, CCRect sp2);

	/// 
	/// update collision
	/// 
	/// kiem tra va thuc hien neu va cham xay ra
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	void fupdateCollision(float delta);

	/// 
	/// check start
	/// 
	/// Bat dau kiem tra
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	void fCheckStart();

private:

	int mType; // loai day leo
	int mNewStatus; // trang thai moi
	int mCurrentStatus; // trang thai hien tai
	int mIsLeft; // la ben trai
	Monkey* mMonkey;

};

#endif //Day leo